<template>
    <div>
        <h1>我是子组件</h1>
        <slot></slot>
        {{ test }}
    </div>
    <div>我是{{ countdown }}</div>
</template>
    
<script setup>
import { onUpdated, ref } from 'vue';

// 父组件传递过来的值也算子组件内部的响应式数据,发生变化同样会触发子组件的更新
const props = defineProps({
    countdown: {
        type: Number,
        default: 0
    }
})
const test = ref('hello')
onUpdated(() => {
    console.log('子组件更新了')
})
setTimeout(() => {
    // test.value = 'world'
}, 2500);
</script>
    
<style lang="scss" scoped>
</style>